package com.sds.sweng.swat.miplatform.ui.design.models.commands;

import java.util.List;

import org.eclipse.gef.commands.Command;

import com.sds.sweng.swat.miplatform.ui.design.models.component.MTableComponents;
import com.sds.sweng.swat.miplatform.ui.design.models.component.logical.LogicalComponent;
import com.sds.sweng.swat.miplatform.ui.design.utils.CloneUtils;

public class CopyTableCellCommand extends Command {

	private MTableComponents targetModel;
	private List<LogicalComponent> srcComponents;
	private List<LogicalComponent> orgComponents;

	public CopyTableCellCommand(MTableComponents targetModel, List<LogicalComponent> srcComponents) {
		this.targetModel = targetModel;
		this.srcComponents = CloneUtils.clone(srcComponents);
		this.orgComponents = CloneUtils.clone(targetModel.getComponents());
	}

	public void execute() {
		targetModel.setComponents(srcComponents);
	}

	public void undo() {
		targetModel.setComponents(orgComponents);
	}

}
